package com.apps.ftapp.util;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;


/**
 * Created by lyli on 2017/10/10.
 */

public class Async {


    private static final String BASE_URL = "http://api.futuyj.com/";
    private static final String BASE_URL2 = "http://www.futuyj.com/";
    private static AsyncHttpClient client = new AsyncHttpClient();

    public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
        client.get(getAbsoluteUrl(url), params, responseHandler);
    }

    public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
//        L.i("main",url);
        client.post(getAbsoluteUrl(url), params, responseHandler);
    }

    private static String getAbsoluteUrl(String relativeUrl) {
        return BASE_URL + relativeUrl;
    }

    public static void post2(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
//        L.i("main",url);
        client.post(BASE_URL2 + url, params, responseHandler);
    }


}
